package com.cch.check.service.impl;

import com.aaa.entity.CheckItem;
import com.aaa.vo.Result;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cch.check.dao.CheckItemDao;
import com.cch.check.service.CheckItemService;
import com.cch.check.vo.InterCheckVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * 检查费用表(SysCheckItem)表服务实现类
 *
 * @author makejava
 * @since 2023-03-24 17:32:14
 */
@Service
public class CheckItemServiceImpl implements CheckItemService {
   @Autowired
   private CheckItemDao checkItemDao;

   @Override
   public Result<List<CheckItem>> selectAllCheckItem() {
      QueryWrapper wrapper = new QueryWrapper<>();
      List<CheckItem> list = checkItemDao.selectList(wrapper);
      return new Result<>(2000,"查询项目名称",list);
   }


   /**
    * 用于调用
    * @param interCheckVo
    * @return
    */

   @Override
   public Page<CheckItem> selectcheck(InterCheckVo interCheckVo) {
      Page<CheckItem> checkitem =new Page(interCheckVo.getCurrent(),interCheckVo.getSize());
      QueryWrapper<CheckItem> wrapper=new QueryWrapper<>();
      if (StringUtils.hasText(interCheckVo.getKeywords())){
         wrapper.eq("keywords",interCheckVo.getKeywords());
      }
      Page<CheckItem> checkItemPage =  checkItemDao.selectPage(checkitem,wrapper);

      return checkItemPage;
   }





}
